package org.schoolnavigator.controller;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class AuthenticationServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5742005029581435213L;

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		int type = 0;
		type = Integer.parseInt(request.getParameter("signin"));
		RequestDispatcher reqDisp;
		
		try{
			if(type != 0){
				switch (type) {
				case 111:
					request.setAttribute("name", request.getParameter("user"));
					reqDisp = request.getRequestDispatcher("jsp/profile.jsp");
					reqDisp.forward(request, response);
					break;
				case 112:
					request.setAttribute("msg", "you are new to here !");
					reqDisp = request.getRequestDispatcher("jsp/profile.jsp");
					reqDisp.forward(request, response);
					break;

				default:
					break;
				}
				
			}
			
		}catch(Exception e){
			e.printStackTrace();
		}
		
	}
	
	public void doGet(HttpServletRequest request, HttpServletResponse response){
		System.out.println("DOGET *******");
	}

}
